package com.lxd.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lxd.entity.enums.DateTimePatternEnum;
import com.lxd.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

public class NewsRequest {
    /**
     *
     */
    private Long id;

    /**
     * 新闻标题
     */
    private String title;

    /**
     * 新闻内容
     */
    private String content;

    /**
     * 作者ID
     */
    private Long authorId;

    /**
     * 作者名称
     */
    private String authorName;

    /**
     * 是否热门  0:否热门  1:小热门 2:中热门 3:大热门
     */
    private Integer hot;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createdAt;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updatedAt;

    private Integer status;

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public void setId(Long id){
        this.id = id;
    }

    public Long getId(){
        return this.id;
    }

    public void setTitle(String title){
        this.title = title;
    }

    public String getTitle(){
        return this.title;
    }

    public void setContent(String content){
        this.content = content;
    }

    public String getContent(){
        return this.content;
    }

    public void setAuthorId(Long authorId){
        this.authorId = authorId;
    }

    public Long getAuthorId(){
        return this.authorId;
    }

    public void setAuthorName(String authorName){
        this.authorName = authorName;
    }

    public String getAuthorName(){
        return this.authorName;
    }

    public void setHot(Integer hot){
        this.hot = hot;
    }

    public Integer getHot(){
        return this.hot;
    }

    public void setCreatedAt(Date createdAt){
        this.createdAt = createdAt;
    }

    public Date getCreatedAt(){
        return this.createdAt;
    }

    public void setUpdatedAt(Date updatedAt){
        this.updatedAt = updatedAt;
    }

    public Date getUpdatedAt(){
        return this.updatedAt;
    }

    @Override
    public String toString (){
        return "id:"+(id == null ? "空" : id)+"，新闻标题:"+(title == null ? "空" : title)+"，新闻内容:"+(content == null ? "空" : content)+"，作者ID:"+(authorId == null ? "空" : authorId)+"，作者名称:"+(authorName == null ? "空" : authorName)+"，是否热门:"+(hot == null ? "空" : hot)+"，创建时间:"+(createdAt == null ? "空" : DateUtil.format(createdAt, DateTimePatternEnum.YYYY_MM_DD_HH_MM_SS.getPattern()))+"，更新时间:"+(updatedAt == null ? "空" : DateUtil.format(updatedAt, DateTimePatternEnum.YYYY_MM_DD_HH_MM_SS.getPattern()));
    }
}
